IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'ImageURL' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN
  EXEC sp_rename @objname= 'CGO_Charity.LogoFile',@newname='ImageURL',@objtype='COLUMN'	
END			

IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'CreatedByID' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN
  EXEC sp_rename @objname= 'CGO_Charity.UserID',@newname='CreatedByID',@objtype='COLUMN'
END

IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'CreatedDate' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN
  EXEC sp_rename @objname= 'CGO_Charity.CreateDate',@newname='CreatedDate',@objtype='COLUMN'
END
  
IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'LastUpdateDate' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN  
  EXEC sp_rename @objname= 'CGO_Charity.UpdateDate',@newname='LastUpdateDate',@objtype='COLUMN'
END  

IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'ImageType' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN
  ALTER TABLE dbo.CGO_Charity ADD ImageType VARCHAR(1) NULL
END

IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'ImageWidth' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN
  ALTER TABLE dbo.CGO_Charity ADD ImageWidth INT NULL
END

IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'ImageHeight' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN  
  ALTER TABLE dbo.CGO_Charity ADD ImageHeight INT NULL
END

IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'ImageDisplay' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN  
  ALTER TABLE dbo.CGO_Charity ADD ImageDisplay BIT NULL
END

IF NOT EXISTS (SELECT 1 FROM sys.columns 
			WHERE name = 'LastUpdatedID' 
			AND object_id = OBJECT_ID(N'[dbo].[CGO_Charity]'))
BEGIN  
  ALTER TABLE dbo.CGO_Charity ADD LastUpdatedID INT NULL
  UPDATE dbo.CGO_Charity SET LastUpdatedID = CreatedByID
  ALTER TABLE dbo.CGO_Charity ALTER COLUMN LastUpdatedID INT NOT NULL
END